package com.wms.common.fusionchart.util;

import java.io.ByteArrayInputStream;
import java.io.InputStream;

import net.sf.json.JSONObject;

import com.wms.common.fusionchart.bean.SeriesChart;

public class FusionChartCreator {
	
	SeriesChart seriesChart;
	
	public FusionChartCreator(SeriesChart seriesChart){
		this.seriesChart = seriesChart;
	}
	
	private String getJSON(){
		if(seriesChart==null) return null;
		JSONObject json = JSONObject.fromObject(seriesChart);
		return json.toString();
	}
	
	public InputStream getStream() throws Exception{
		String json = getJSON();
		byte[] jsonBytes=json.getBytes("utf-8"); 
		return new ByteArrayInputStream(jsonBytes);
	}
}
